//
//  ScreenAdapter.m
//  MyDemo
//
//  Created by ci123 on 15-3-4.
//  Copyright (c) 2015年 ci123nbg. All rights reserved.
//

#import "ScreenAdapter.h"
#import <UIKit/UIKit.h>
static ScreenAdapter* mScreenAdapter;

@implementation ScreenAdapter

@synthesize targetWidth,targetHeight,screenWidth,screenHeight,ratioWidth,ratioHeight,imageScale;

-(void)ScreenAdapter{
    NSLog(@"Screen Adapter ctor.");
}

+(ScreenAdapter *)getInstanse{
    if (mScreenAdapter == NULL) {
        mScreenAdapter = [[ScreenAdapter alloc]init];
        [mScreenAdapter initData];
    }
    return mScreenAdapter;
}

-(void) initData{
    targetWidth = 320;
    targetHeight = 480;
    screenWidth = [UIScreen mainScreen].bounds.size.width;
    screenHeight = [UIScreen mainScreen].bounds.size.height;
    ratioWidth = screenWidth/targetWidth;
    ratioHeight = screenHeight/targetHeight;
    imageScale = ratioWidth<ratioHeight?ratioWidth:ratioHeight;
    NSLog(@"多分辨率适配参数初始化完成：");
    NSLog(@"当前屏幕的尺寸：%f * %f",screenWidth, screenHeight);
    NSLog(@"长宽缩放比 W:H = %f:%f",ratioWidth,ratioHeight);
    NSLog(@"按钮图片缩放比 R = %f",imageScale);
}

@end
